using UnityEngine;

namespace JJYYCore
{
    public abstract class UIPageBase : MonoBehaviour
    {
        public void OpenPage()
        {
            gameObject.SetActive(true);
        }

        public void ClosePage()
        {
            gameObject.SetActive(false);
        }

        public abstract void InitPage(object dataBase);

        protected void SetSubPages(Subpages subpages, Transform subPageRoot)
        {
            for (int i = 0; i < subPageRoot.childCount; i++)
            {
                var selection = subPageRoot.GetChild(i);
                subpages.AddPage(selection.name, selection);
            }
        }
    }
}